#pragma once
#include "vocoder.h"
#include <vector>

/*
LoopCarrier stores a sample whose contents are gradually returned in CreateCarrierSample
When the stored sample reaches the end, it simply continues again from the beginning
*/
class LoopCarrier :
	public Carrier
{
public:
	LoopCarrier(void);
	~LoopCarrier(void);

	/*
	Set the sample to be used by LoopCarrier.
	LoopCarrier makes its own copy, and caller must make sure that the incoming array gets disposed.
	*/
	void SetSample(short* s, unsigned int length);

	void SetFrequencyProvider(FrequencyProvider* frequencyProvider){}
	void SetVocoderListener(VocoderListener* vocoderListener){};
	short* CreateCarrierSample(Settings* settings, short* modulatorSample, unsigned int length, std::vector<SampleMarker>* markers);

private:
	unsigned int curIdx;
	std::vector<short> sample;
	std::vector<short> lastReturned;
};
